#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read(){
	int x=0;bool f=0;char ch=getchar();
	while(ch<'0'||ch>'9')f^=(ch=='-'),ch=getchar();
	while('0'<=ch&&ch<='9')x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
const int Maxn=32768;
int n;
struct edge{
	int u,v,w;
}e[555];
int cnt1;
int vis[20][20];
int cnt;
signed main(){
//	ios::sync_with_stdio(0);
//	cin.tie(0);cout.tie(0);
	freopen("road.in","r",stdin);
	freopen("road.out","w",stdout);
	n=read();
	for(int x=n;x>1;x/=2)cnt++;
	e[++cnt1]={1,2,0};
	for(int i=0;i<=cnt;i++)
		e[++cnt1]={i+2,i+3,(1<<i)},e[++cnt1]={i+2,i+3,0};
	cnt++;int sum=0;
	n++;
	while(n){
		int i=20;
		while(n<(1<<i))i--;
		if(n>=(1<<i)){
			e[++cnt1]={i+2,114,sum};
			n-=(1<<i);
			sum+=(1<<i);
		}
	}
	printf("%d %d\n",cnt+3,cnt1);
	for(int i=1;i<=cnt1;i++){
		printf("%d %d %d\n",e[i].u,e[i].v,e[i].w);
	}
	return 0;
}
/*
checker.exe road.in road.out road1.in 10 score.txt report.txt
*/
